using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.EnterpriseLibrary.Data.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Data;

namespace EntLibContrib.Data.SQLite
{
    /// <summary>
    /// Represents the process to build an instance of <see cref="SQLiteDatabase"/> described by configuration information.
    /// </summary>
    public class SQLiteDatabaseAssembler : IDatabaseAssembler
    {
        #region IDatabaseAssembler Members

        /// <summary>
        /// Builds an instance of the concrete subtype of <see cref="Database"/> the receiver knows how to build, based on
        /// the provided connection string and any configuration information that might be contained by the
        /// <paramref name="configurationSource"/>.
        /// </summary>
        /// <param name="name">The name for the new database instance.</param>
        /// <param name="connectionStringSettings">The connection string for the new database instance.</param>
        /// <param name="configurationSource">The source for any additional configuration information.</param>
        /// <returns>The new database instance.</returns>
        public Database Assemble(string name, System.Configuration.ConnectionStringSettings connectionStringSettings, Microsoft.Practices.EnterpriseLibrary.Common.Configuration.IConfigurationSource configurationSource)
        {
            return new SQLiteDatabase(connectionStringSettings.ConnectionString);
        }

        #endregion
    }
}
